package org.dromara.exam.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.excel.core.ExcelListener;
import org.dromara.common.excel.core.ExcelResult;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.exam.domain.bo.ExamTemplateImportBo;
import org.dromara.exam.service.IExamTemplateService;

/**
 * @author :xiyin321
 * @since : 2024/4/23 22:01
 */
public class ExamQuestionImportListener extends AnalysisEventListener<ExamTemplateImportBo> implements ExcelListener<ExamTemplateImportBo> {

    private final IExamTemplateService questionService;

    private final Boolean isUpdateSupport;

    // 登入用户ID
    private final Long operUserId;

    private final StringBuilder successMsg = new StringBuilder();
    private final StringBuilder failureMsg = new StringBuilder();

    /*当前题库ID*/
    private final Long repoId;
    private int successNum = 0;
    private int failureNum = 0;

    public ExamQuestionImportListener(Boolean isUpdateSupport, Long repoId) {
        this.questionService = SpringUtils.getBean(IExamTemplateService.class);
        this.isUpdateSupport = isUpdateSupport;
        this.repoId=repoId;
        this.operUserId = LoginHelper.getUserId();
    }

    @Override
    public void invoke(ExamTemplateImportBo examQuestionImportVo, AnalysisContext context) {

    }

    @Override
    public ExcelResult<ExamTemplateImportBo> getExcelResult() {
        return null;
    }



    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
